library(readxl)
library(ggplot2)
library(wordcloud)
## Loading required package: RColorBrewer
library(RColorBrewer)
library(wordcloud2)
library(reshape)
library(tm)
## Loading required package: NLP
##
## Attaching package: 'NLP'
## The following object is masked from 'package:ggplot2':
##
## annotate
library(stringr)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:reshape':
##
## rename
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(usmap)
data <- read_excel("~/Documents/GitHub/dspg23census/project_website/Mission_Statements/mission_statements.xlsx")
#Host Types
#Bar graph of host org. counts
host_counts <- ggplot(data, aes(x=Host_Type)) + geom_bar(fill="steelblue") + labs(x="Type of Host Organization", y="Count", title="Host Ogranizations for SDC Lead Agencies")
ggplotly(host_counts)
#fix: change color - color blind palette
#fix: add PR and Guam
#map of host types
#color_palette <- brewer.pal(4, "Set1")
hosts <- data.frame(state = data$State, type = data$Host_Type)
host_map <- plot_usmap(data = hosts, values = "type", labels = TRUE) + labs(title="Type of Lead Agency")
host_map

#Do SDCs have Mission Statements?
#fix: this shows both SDC and Host Orgs, want only SDCs
#Bar graph of Y/N statement counts
statement_counts <- ggplot(data, aes(x=Mission_Statement_Status)) + geom_bar(fill="steelblue") + labs(x = "", y="Count", title="Do SDCs Have Mission Statements")
ggplotly(statement_counts)
#Coordinating Agencies
#make this prettier
#Number of coordinating agencies by state
coordinating_counts <- ggplot(data, aes(x=State, y=Coordinating)) + geom_point() + labs(x = "State", y="Number of Coordinating Agencies", title="Number of Coordinating Agencies by State") + theme(axis.text.x = element_text(angle = 45))
ggplotly(coordinating_counts)
#Map of number of coordinating agencies
coord <- data.frame(state = data$State, number = data$Coordinating)
coord_map <- plot_usmap(data=coord, values="number") + labs(title="Number of Coordinating Agencies")
ggplotly(coord_map)
examined_SDC <- data.frame(state = data$State, value = data$Examined)
examined_map <- plot_usmap(data = examined_SDC, values="value")
ggplotly(examined_map)